YAML handling

Automatic definition of arguments yaml_parse

This module deals with the parsing of yaml streams and their conversion into FUTILE dictionaries.

Anyone which uses python knows how practical it the usage of the argparse module. This FORTRAN module is an attempt to combine the ideas of the argparse approach with the yaml syntax.

Quick access

Variables

error_yaml_command_line_parser, yaml_parse_unsupported

Routines

yaml_argparse(), yaml_cl_parse_cmd_line(), yaml_cl_parse_free(), yaml_cl_parse_null(), yaml_cl_parse_option(), yaml_load(), yaml_parse_database(), yaml_parse_errors(), yaml_parse_errors_finalize(), yaml_parse_from_char_array(), yaml_parse_from_file(), yaml_parse_from_string()

Needed modules

Variables

  • yaml_parse/error_yaml_command_line_parser [integer,public/optional/default=0]
  • yaml_parse/yaml_parse_unsupported [integer,public/optional/default=0]

Subroutines and functions

interface  yaml_parse/yaml_cl_parse_option(parser, string_bn, name, default_bn, help_string, dict[, shortname, help_dict, first_option, conflicts])
Parameters
  • parser [yaml_cl_parse, inout]

  • string_bn [character(len=*), in]

  • name [character(len=*), in]

  • default_bn [character(len=*), in]

  • help_string [character(len=*), in]

  • dict [dictionary, pointer]

Options
  • shortname [character(len=1), in,]

  • help_dict [dictionary, pointer]

  • first_option [logical, in,]

  • conflicts [character(len=*), in,]

function  yaml_parse/yaml_cl_parse_null()
Return

parser [yaml_cl_parse]

Called from

yaml_cl_parse_free(), yaml_argparse()

subroutine  yaml_parse/yaml_cl_parse_free(parser)
Parameters

parser [yaml_cl_parse, inout]

Use

dictionaries_base (dict_free())

Called from

yaml_argparse(), yaml_cl_parse_cmd_line()

Call to

dict_free(), yaml_cl_parse_null()

subroutine  yaml_parse/yaml_cl_parse_option(parser, name, default_bn, help_string[, shortname, help_dict, first_option, conflicts])
Parameters
  • parser [yaml_cl_parse, inout]

  • name [character(len=*), in]

  • default_bn [character(len=*), in]

  • help_string [character(len=*), in]

Options
  • shortname [character(len=1), in,]

  • help_dict [dictionary, pointer]

  • first_option [logical, in,]

  • conflicts [character(len=*), in,]

Use

dictionaries, yaml_strings

Called from

yaml_argparse()

Call to

f_err_throw(), dict_new(), dict_iter(), dict_key(), dict_next(), set(), yaml_load(), dict_update(), dict_free(), dict_init(), f_strcpy()

subroutine  yaml_parse/yaml_argparse(options, string_bn)
Parameters
  • options [dictionary, pointer]

  • string_bn [character(len=*), in]

Use

dictionaries, f_utils (f_zero())

Call to

yaml_cl_parse_null(), yaml_cl_parse_option(), yaml_cl_parse_cmd_line(), yaml_cl_parse_free()

subroutine  yaml_parse/yaml_cl_parse_cmd_line(parser[, args])
Parameters

parser [yaml_cl_parse, inout]

Options

args [dictionary, out,pointer]

Use

dictionaries, yaml_strings (f_strcpy()), yaml_output

Called from

yaml_argparse()

Call to

f_err_check(), dict_update(), dict_free(), dict_iter(), dict_key(), dict_value(), f_err_throw(), dict_next(), dict_copy(), yaml_cl_parse_free(), f_strcpy(), yaml_load()

subroutine  yaml_parse/yaml_parse_errors()
Use

dictionaries

Call to

f_err_define(), dict_new()

subroutine  yaml_parse/yaml_parse_from_file(dict, fname)
Parameters
  • dict [dictionary, pointer]

  • fname [character(len=*), in]

Use

dictionaries

Called from

get_proc_status_dict()

subroutine  yaml_parse/yaml_parse_database(dict, symbol)
Parameters
  • dict [dictionary, pointer]

  • symbol [external] :: <we fill the array

Use

f_precisions, yaml_parse_database__user__routines

Call to

yaml_parse_from_char_array()

subroutine  yaml_parse/yaml_parse_from_char_array(dict, carr)
Parameters
  • dict [dictionary, pointer]

  • carr (*) [character, in]

Use

dictionaries

Called from

yaml_parse_database()

subroutine  yaml_parse/yaml_parse_from_string(dict, str)
Parameters
  • dict [dictionary, pointer]

  • str [character(len=*), in]

Use

dictionaries

Called from

yaml_load()

function  yaml_parse/yaml_load(string_bn[, key])
Parameters

string_bn [character(len=*), in]

Options

key [character(len=*), in,]

Return

dict [dictionary, pointer]

Use

dictionaries, yaml_strings (f_strcpy())

Called from

f_purge_database(), f_tree_load(), yaml_cl_parse_option(), yaml_cl_parse_cmd_line()

Call to

yaml_parse_from_string(), dict_free(), dict_value(), dict_init(), dict_copy(), dict_new(), dict_iter()

subroutine  yaml_parse/yaml_parse_errors_finalize()
Use

dictionaries_base (dict_free())

Call to

dict_free()

YAML emitter in Fortran: the yaml_output module

Quick access

Routines

dump_progress_bar(), yaml_bib_dump(), yaml_cite(), yaml_close_all_streams(), yaml_close_stream(), yaml_comment(), yaml_dict_dump(), yaml_dict_dump_all(), yaml_dict_inspect(), yaml_flush_document(), yaml_get_default_stream(), yaml_map(), yaml_mapping_close(), yaml_mapping_open(), yaml_new_document(), yaml_newline(), yaml_output_errors(), yaml_release_document(), yaml_scalar(), yaml_sequence(), yaml_sequence_close(), yaml_sequence_open(), yaml_set_default_stream(), yaml_set_stream(), yaml_stream_attributes(), yaml_stream_connected(), yaml_swap_stream(), yaml_warning()

Needed modules

  • yaml_strings

  • dictionaries

  • f_precisions: This module enhances the portability of various kind of variables and defines other objects that might be used in the host code

Subroutines and functions

interface  yaml_output/yaml_map(mapname, mapvalue[, label, tag, advance, unit, flow, fmt])

general scalar

Parameters
  • mapname [character(len=*), in] :: < @copydoc doc::mapname

  • mapvalue (various shapes) [character(len=*), dictionary, integer, real, logical, in] :: < scalar value of the mapping may be of any scalar type

Options
  • label [character(len=*), in,] :: < @copydoc doc::label

  • tag [character(len=*), in,] :: < @copydoc doc::tag

  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

  • flow [logical, in,] :: < @copydoc doc::flow

  • fmt [character(len=*), in,]

Called from

f_routine(), f_release_routine(), f_malloc_finalize(), f_malloc_dump_status(), dump_f_matrix_ptr(), memstate_report(), f_profile(), yaml_stream_attributes(), yaml_dict_inspect(), yaml_bib_dump()

interface  yaml_output/yaml_warning(message[, level, unit])
Parameters

message [character(len=*), f_string, in] :: < Warning message

Options
  • level [integer, in,] :: < Level of the message (if < Wall then abort)

  • unit [integer, in,] :: < @copydoc doc::unit

Called from

f_malloc_finalize(), f_malloc_dump_status(), yaml_new_document(), yaml_cite()

interface  yaml_output/yaml_comment(message[, advance, unit, hfill, tabbing])
Parameters

message [character(len=*), f_string, in] :: < The given comment (without #)

Options
  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

  • hfill [character(len=*), in,] :: < If present fill the line with the given character

  • tabbing [integer, in,] :: < Number of space for tabbing

Called from

f_release_routine(), f_malloc_set_status(), input_file_dump(), dump_progress_bar(), yaml_dict_dump_all(), yaml_release_document()

subroutine  yaml_output/yaml_swap_stream(new_unit, old_unit, ierr)
Parameters
  • new_unit [integer, in] :: < new unit

  • old_unit [integer, out] :: < old unit

  • ierr [integer, out] :: < error code

Call to

yaml_get_default_stream(), yaml_set_default_stream()

subroutine  yaml_output/yaml_output_errors()
Use

exception_callbacks (f_err_set_last_error_callback(), f_err_set_all_errors_callback())

Call to

f_err_define(), dict_init(), f_err_set_last_error_callback(), f_err_set_all_errors_callback()

subroutine  yaml_output/yaml_set_default_stream(unit, ierr)
Parameters
  • unit [integer, in] :: < stream unit

  • ierr [integer, out] :: < error code

Called from

yaml_swap_stream()

subroutine  yaml_output/yaml_get_default_stream(unit)
Parameters

unit [integer, out]

Called from

f_malloc_dump_status(), yaml_swap_stream()

subroutine  yaml_output/yaml_stream_connected(filename, unit[, istat])
Parameters
  • filename [character(len=*), in] :: < Filename of the stream to inquire

  • unit [integer, out] :: < File unit specified by the user.(by default 6) Returns a error code if the unit

Options

istat [integer, out,] :: so far

Call to

has_key()

subroutine  yaml_output/yaml_set_stream([unit, filename, istat, tabbing, record_length, position, setdefault])
Options
  • unit [integer, in,] :: < File unit specified by the user.(by default 6) Returns a error code if the unit

  • filename [character(len=*), in,] :: < Filename of the stream

  • istat [integer, out,] :: so far

  • tabbing [integer, in,] :: < Indicate a tabbing for the stream (0 no tabbing, default)

  • record_length [integer, in,] :: int(record_length,kind=8)

  • position [character(len=*), in,]

  • setdefault [logical, in,] :: < decide if the new stream will be set as default stream. True if absent

Use

f_utils (f_utils_recl(), f_get_free_unit(), f_open_file())

Called from

f_malloc_set_status(), f_malloc_dump_status()

Call to

has_key(), f_get_free_unit(), f_err_raise(), f_err_throw(), f_err_open_try(), f_open_file(), f_get_last_error(), f_err_close_try(), f_utils_recl(), set()

subroutine  yaml_output/yaml_stream_attributes([unit, stream_unit, icursor, flowrite, itab_active, iflowlevel, ilevel, ilast, indent, indent_previous, record_length])
Options
  • unit [integer, in,] :: < File unit to display

  • stream_unit [integer, in,] :: < Stream Id

  • icursor [integer, out,] :: < @copydoc yaml_stream::icursor

  • flowrite [logical, out,] :: < @copydoc yaml_stream::flowrite

  • itab_active [integer, out,] :: < @copydoc yaml_stream::itab_active

  • iflowlevel [integer, out,] :: < @copydoc yaml_stream::iflowlevel

  • ilevel [integer, out,] :: < @copydoc yaml_stream::ilevel

  • ilast [integer, out,] :: < @copydoc yaml_stream::ilast

  • indent [integer, out,] :: < @copydoc yaml_stream::indent

  • indent_previous [integer, out,] :: < @copydoc yaml_stream::indent_previous

  • record_length [integer, out,] :: < Maximum number of columns of the stream (default @link yaml_output::yaml_stream::tot_max_record_length @endlink)

Call to

yaml_newline(), yaml_mapping_open(), yaml_map(), yaml_mapping_close()

subroutine  yaml_output/yaml_new_document([unit])
Options

unit [integer, in,] :: < @copydoc doc::unit

Called from

f_timing_reset(), yaml_dict_dump_all()

Call to

yaml_warning()

subroutine  yaml_output/yaml_flush_document([unit])
Options

unit [integer, in,] :: < @copydoc doc::unit

Called from

f_routine(), f_release_routine(), f_update_database(), f_purge_database(), yaml_release_document()

Call to

f_utils_flush()

subroutine  yaml_output/yaml_close_stream([unit, istat])
Options
  • unit [integer, in,] :: < @copydoc doc::unit

  • istat [integer, out,] :: <error code, zero if suceeded

Called from

f_malloc_set_status(), f_malloc_finalize(), f_malloc_dump_status(), yaml_close_all_streams()

Call to

f_err_raise(), yaml_release_document(), dict_iter(), dict_size(), dict_remove(), dict_key(), dict_init(), dict_next()

subroutine  yaml_output/yaml_close_all_streams()
Call to

yaml_close_stream(), yaml_release_document(), dict_free()

subroutine  yaml_output/yaml_dict_inspect(dict)
Parameters

dict [dictionary, pointer]

Call to

yaml_map(), yaml_mapping_open(), yaml_mapping_close()

subroutine  yaml_output/dump_progress_bar(bar[, step, unit])
Parameters

bar [f_progress_bar, inout]

Options
  • step [integer, in,]

  • unit [integer, in,]

Use

f_precisions, f_utils

Call to

yaml_newline(), update_progress_bar(), f_tty(), yaml_comment(), f_utils_flush()

subroutine  yaml_output/yaml_cite(paper[, unit])
Parameters

paper [character(len=*), in] :: <the item to be cited in the bibliography

Options

unit [integer, in,]

Use

f_bibliography, f_utils

Call to

f_bib_item_exists(), dict_init(), get_bib_filename(), f_open_file(), f_close(), add(), f_bib_get_item(), dict_value(), yaml_warning()

subroutine  yaml_output/yaml_bib_dump(citations[, unit])
Parameters

citations [dictionary, pointer]

Options

unit [integer, in,] :: < yaml stream associated

Use

f_bibliography, f_utils

Call to

yaml_mapping_open(), f_bib_get_item(), dict_value(), yaml_map(), dict_key(), yaml_mapping_close()

subroutine  yaml_output/yaml_scalar(message[, advance, unit, hfill])
Parameters

message [character(len=*), in] :: < the message to be printed

Options
  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

  • hfill [character(len=*), in,] :: < If present fill the line with the given character

subroutine  yaml_output/yaml_mapping_open([mapname, label, tag, flow, tabbing, advance, unit])
Options
  • mapname [character(len=*), in,] :: < Key of the sequence. @copydoc doc::mapname

  • label [character(len=*), in,] :: < @copydoc doc::label

  • tag [character(len=*), in,] :: < @copydoc doc::tag

  • flow [logical, in,] :: < @copydoc doc::flow

  • tabbing [integer, in,] :: < @copydoc doc::tabbing

  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

Called from

f_routine(), f_malloc_finalize(), f_malloc_dump_status(), f_tree_dump(), memstate_report(), f_profile(), yaml_stream_attributes(), yaml_dict_inspect(), yaml_bib_dump()

subroutine  yaml_output/yaml_mapping_close([advance, unit])
Options
  • advance [character(len=*), in,] :: <@copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

Called from

f_release_routine(), f_malloc_finalize(), f_malloc_dump_status(), f_tree_dump(), memstate_report(), f_profile(), yaml_stream_attributes(), yaml_dict_inspect(), yaml_bib_dump()

subroutine  yaml_output/yaml_sequence_open([mapname, label, tag, flow, tabbing, advance, unit])
Options
  • mapname [character(len=*), in,] :: < Key of the sequence. @copydoc doc::mapname

  • label [character(len=*), in,] :: < @copydoc doc::label

  • tag [character(len=*), in,] :: < @copydoc doc::tag

  • flow [logical, in,] :: < @copydoc doc::flow

  • tabbing [integer, in,] :: < @copydoc doc::tabbing

  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

Called from

f_malloc_set_status(), dump_status_line()

subroutine  yaml_output/yaml_sequence_close([advance, unit])
Options
  • advance [character(len=*), in,]

  • unit [integer, in,]

Called from

f_malloc_finalize(), dump_status_line()

subroutine  yaml_output/yaml_newline([unit])
Options

unit [integer, in,] :: < @copydoc doc::unit

Called from

f_malloc_dump_status(), yaml_stream_attributes(), dump_progress_bar(), yaml_release_document()

subroutine  yaml_output/yaml_sequence([seqvalue, label, advance, unit, padding])
Options
  • seqvalue [character(len=*), in,] :: < value of the sequence

  • label [character(len=*), in,] :: < @copydoc doc::label

  • advance [character(len=*), in,] :: < @copydoc doc::advance

  • unit [integer, in,] :: < @copydoc doc::unit

  • padding [integer, in,] :: < pad the seqvalue with blanks to have more readable output

Called from

dump_status_line()

Call to

buffer_string()

subroutine  yaml_output/yaml_dict_dump(dict[, unit, flow, verbatim])
Parameters

dict [dictionary, in,pointer] :: < Dictionary to dump

Options
  • unit [integer, in,] :: < unit in which the dump has to be

  • flow [logical, in,] :: < @copydoc doc::flow

  • verbatim [logical, in,] :: < if .true. print as comments the calls performed

Called from

f_release_routine(), f_tree_dump(), yaml_dict_dump_all(), yaml_release_document()

Call to

dict_value(), dict_len(), dict_next(), dict_size(), dict_item(), dict_key()

subroutine  yaml_output/yaml_dict_dump_all(dict[, unit, flow, verbatim])
Parameters

dict [dictionary, in,pointer] :: < Dictionary to dump

Options
  • unit [integer, in,] :: < unit in which the dump has to be

  • flow [logical, in,] :: < if .true. inline

  • verbatim [logical, in,] :: < if .true. print as comments the calls performed

Call to

f_err_raise(), dict_len(), yaml_comment(), yaml_new_document(), yaml_dict_dump(), yaml_release_document()

subroutine  yaml_output/yaml_release_document([unit])
Options

unit [integer, in,] :: < @copydoc doc::unit

Called from

yaml_close_stream(), yaml_close_all_streams(), yaml_dict_dump_all()

Call to

yaml_newline(), yaml_comment(), yaml_dict_dump(), dict_free(), yaml_flush_document()

Convenient string functions: the yaml_strings module

Quick access

Types

f_string

Variables

yaml_infinity

Routines

align_message(), buffer_string(), convert_f_char_ptr(), f_char_ptr(), f_strcpy(), is_atof(), is_atoi(), is_atol(), is_atoli(), operator(**)(), operator(.eqv.)(), operator(.neqv.)(), read_fraction_string(), rstrip(), shiftstr(), yaml_blink(), yaml_bold(), yaml_date_and_time_toa(), yaml_date_toa(), yaml_time_toa(), yaml_toa()

Needed modules

  • f_precisions: This module enhances the portability of various kind of variables and defines other objects that might be used in the host code

Types

  • type  yaml_strings/f_string
    Type fields
    • % msg [character(len=4*max_value_length)]

Variables

  • yaml_strings/yaml_infinity [character(len=*),public/parameter/optional/default='.inf']

Subroutines and functions

interface  yaml_strings/yaml_toa(data, l, d, vec, z[, fmt])
Parameters
  • data [integer, real, in]

  • l [logical, in]

  • d [character(len=*), in]

  • vec (*) [real, integer, character(len=*), double_complex, logical, in]

  • z [double_complex, in]

Options

fmt [character(len=*), in,]

interface  yaml_strings/f_strcpy(dest, src)
Parameters
  • dest [character(len=*), out]

  • src [character(len=*), f_string, in]

interface  yaml_strings/operator(.eqv.)(a, b)
Parameters
  • a [character(len=*), in]

  • b [character(len=*), in]

interface  yaml_strings/operator(.neqv.)(a, b)
Parameters
  • a [character(len=*), in]

  • b [character(len=*), in]

interface  yaml_strings/operator(//)(a, num)
Parameters
  • a [character(len=*), f_string, integer, in]

  • num [integer, real, f_string, character(len=*), in]

interface  yaml_strings/operator(+)(a, b, s, num)
Parameters
  • a [character(len=*), f_string, in]

  • b [character(len=*), f_string, in]

  • s [character(len=*), in]

  • num [integer, real, in]

interface  yaml_strings/assignment(=)(string_bn, msg)
Parameters
  • string_bn [character(len=*), out]

  • msg [f_string, in]

interface  yaml_strings/operator(**)(num, fmt)
Parameters
  • num [integer, real, character(len=*), in]

  • fmt [character(len=*), in]

subroutine  yaml_strings/f_strcpy(dest, src)
Parameters
  • dest [character(len=*), out]

  • src [character(len=*), in]

Called from

f_purge_database(), f_malloc_set_status(), input_keys_get_profile(), update_progress_bar(), f_open_file(), memstate_report(), dump_status_line(), get_proc_status_dict(), yaml_cl_parse_option(), yaml_cl_parse_cmd_line()

function  yaml_strings/yaml_bold(str)
Parameters

str [character(len=*), in]

Return

bstr [character(len=max_value_length)]

Parameters

str [character(len=*), in]

Return

bstr [character(len=max_value_length)]

subroutine  yaml_strings/buffer_string(string_bn, string_lgt, buffer, string_pos[, back, istat])
Parameters
  • string_bn [character(len=string_lgt), inout]

  • string_lgt [integer, in]

  • buffer [character(len=*), in]

  • string_pos [integer, inout]

Options
  • back [logical, in,]

  • istat [integer, out,]

Called from

yaml_sequence()

subroutine  yaml_strings/align_message(rigid, maxlen, tabval, anchor, message)
Parameters
  • rigid [logical, in]

  • maxlen [integer, in]

  • tabval [integer, in]

  • anchor [character(len=*), in]

  • message [character(len=maxlen), inout]

Call to

shiftstr()

function  yaml_strings/yaml_date_and_time_toa([values, zone])
Options
  • values (8) [integer, in,]

  • zone [logical, in,]

Return

yaml_date_and_time_toa [character(len=max_value_length)]

Called from

f_malloc_initialize()

function  yaml_strings/yaml_date_toa([values])

Yaml Spaced format for Date

Options

values (8) [integer, in,]

Return

yaml_date_toa [character(len=max_value_length)]

function  yaml_strings/yaml_time_toa([values])
Options

values (8) [integer, in,]

Return

yaml_time_toa [character(len=max_value_length)]

Called from

f_routine(), f_release_routine(), update_progress_bar()

function  yaml_strings/is_atoi(str)
Parameters

str [character(len=*), in]

Return

yes [logical]

function  yaml_strings/is_atoli(str)
Parameters

str [character(len=*), in]

Return

yes [logical]

function  yaml_strings/is_atof(str)
Parameters

str [character(len=*), in]

Return

yes [logical]

function  yaml_strings/is_atol(str)
Parameters

str [character(len=*), in]

Return

yes [logical]

subroutine  yaml_strings/read_fraction_string(string_bn, var, ierror)
Parameters
  • string_bn [character(len=*), in]

  • var [double_precision, out]

  • ierror [integer, out]

subroutine  yaml_strings/rstrip(string_bn, substring)
Parameters
  • string_bn [character(len=*), inout]

  • substring [character(len=*), in]

subroutine  yaml_strings/shiftstr(str, n)
Parameters
  • str [character(len=*), inout]

  • n [integer, in]

Called from

align_message()

function  yaml_strings/f_char_ptr(str)
Parameters

str [character(len=*), in]

Return

f_char_ptr (len_trim(str)+1) [character]

Called from

f_char_ptr()

Call to

f_char_ptr()

subroutine  yaml_strings/convert_f_char_ptr(src, dest)
Parameters
  • src (*) [character, in]

  • dest [character(len=*), out]

Called from

bind_dict_set_string(), bind_dict_add_char()